// TODO: 品牌列表类型

// ? 请求品牌列表数据

// 参数
export interface RequestTrademarkListParamsType {
  page: number;
  limit: number;
}

// 返回值
export interface RequestTrademarkListReturnType {
  records: RequestTrademarkListReturnRecordsType;
  total: number;
  size: number;
  current: number;
  searchCount: boolean;
  pages: number;
}

export interface RequestTrademarkListReturnRecordItemType {
  id: number;
  tmName: string;
  logoUrl: string;
}

export type RequestTrademarkListReturnRecordsType =
  RequestTrademarkListReturnRecordItemType[];

// ? 新增品牌数据

// 参数
export interface RequestAddTardemarkParamsType {
  logoUrl: string;
  tmName: string;
}

// ? 修改品牌数据

// 参数
export interface RequestUpdataTardemarkParamsType
  extends RequestAddTardemarkParamsType {
  id: number;
}

// 返回值
export type TardemarkListType = TardemarkItemType[];

export interface TardemarkItemType {
  id: number;
  tmName: string;
  logoUrl: string;
}

//TODO: 属性管理类型

// ? 一级分类数据

// 返回值

export interface RequestCartgoryOneReturnItemType {
  id: number;
  name: string;
}

export type RequestCartgoryOneReturnType = RequestCartgoryOneReturnItemType[];

// ? 二级分类数据

// 返回值

export interface RequestCartgoryTwoReturnItemType
  extends RequestCartgoryOneReturnItemType {
  category1Id: number;
}

export type RequestCartgoryTwoReturnType = RequestCartgoryTwoReturnItemType[];

// ? 三级级分类数据

// 返回值

export interface RequestCartgoryThreeReturnItemType
  extends RequestCartgoryTwoReturnItemType {
  category2Id: number;
}

export type RequestCartgoryThreeReturnType =
  RequestCartgoryThreeReturnItemType[];

// ? 请求品牌属性列表数据

// 参数

export interface RequestTardemarkAttrListParamsType {
  category1Id: number;
  category2Id: number;
  category3Id: number;
}

// 返回值

export interface RequestTardemarkAttrListReturnItemType {
  id?: number;
  attrName: string;
  attrValueList: RequestTardemarkAttrListReturnAttrValueListType;
  categoryId: number;
  categoryLevel: number;
  // 自定义数据
  attrIdValueId?: string;
}

export type RequestTardemarkAttrListReturnType =
  RequestTardemarkAttrListReturnItemType[];

export interface RequestTardemarkAttrListReturnAttrValueListItemType {
  id?: number;
  attrId: number | undefined;
  valueName: string;
  // 自定义数据
  isEdit?: boolean;
}

export type RequestTardemarkAttrListReturnAttrValueListType =
  RequestTardemarkAttrListReturnAttrValueListItemType[];

// TODO: Spu 管理类型

// ? Spu 基础销售属性列表（颜色，版本，尺码）

// 返回值

export interface SpuBaseSaleAttrItemType {
  id: number;
  name: string;
}

export type SpuBaseSaleAttrListType = SpuBaseSaleAttrItemType[];

// ? Spu 数据类型(新增没有 id 修改有 id)

// 返回值
export interface SpuInfoType {
  category3Id: number | null;
  description: string;
  id?: number;
  spuImageList: SpuImageListType | null;
  spuName: string;
  spuSaleAttrList: SpuSaleAttrListType | null;
  tmId: number | null;
}

// spuImageList(Spu 图片列表) 类型
export type SpuImageListType = SpuImageItemType[];

export interface SpuImageItemType {
  id?: number;
  imgName: string;
  imgUrl: string;
  spuId?: number;
  name?: string;
  url?: string;
  // 用户操作临时数据
  response?: any;
  isDefault?: string;
}

// spuSaleAttrList(Spu 销售属性列表) 类型
export type SpuSaleAttrListType = SpuSaleAttrItemType[];

export interface SpuSaleAttrItemType {
  baseSaleAttrId: number;
  id?: number;
  saleAttrName: string;
  spuId?: number;
  spuSaleAttrValueList: SpuSaleAttrValueListType;
  // 添加的属性
  isEdit?: boolean;
  inputValue?: string;
  attrIdAttrValueId?: string;
}

// spuSaleAttrValueList(Spu 销售属性值列表) 类型
export type SpuSaleAttrValueListType = SpuSaleAttrValueItemType[];

export interface SpuSaleAttrValueItemType {
  baseSaleAttrId: number;
  id?: number;
  isChecked?: string;
  saleAttrName?: string;
  saleAttrValueName: string;
  spuId?: number;
}

// ? Spu 分页列表数据类型

// 返回值
export interface SpuInfoListType {
  current: number;
  pages: number;
  searchCount: boolean;
  size: number;
  total: number;
  records: recordsType;
}

export type recordsType = SpuInfoType[];

// TODO: Sku 管理类型

// ? Sku 列表数据类型

// 返回值
export type SkuListType = SkuItemType[];

export interface SkuItemType {
  id?: number;
  spuId?: number;
  price: number;
  skuName: string;
  skuDesc: string;
  weight: string;
  tmId?: number | null;
  category3Id: number | null;
  skuDefaultImg: string;
  isSale?: number;
  createTime?: string;
  skuImageList: SkuImageListType | null;
  skuAttrValueList: SkuAttrValueListType | null;
  skuSaleAttrValueList: SkuSaleAttrValueListType | null;
}

// 单个 Sku 的图片详细信息
export type SkuImageListType = SkuImageItem[];
export interface SkuImageItem {
  id?: number;
  skuId?: number;
  imgName: string;
  imgUrl: string;
  spuImgId?: number;
  isDefault?: string;
}

// 单个 Sku 的属性详细信息
export type SkuAttrValueListType = SkuAttrValueItemType[];
export interface SkuAttrValueItemType {
  id?: number;
  attrId: number;
  valueId: number;
  skuId?: number;
  attrName?: string;
  valueName?: string;
}

// 单个 Sku 的销售属性详细信息(根据 spu 规定的属性)
export type SkuSaleAttrValueListType = SkuSaleAttrValueItemType[];
export interface SkuSaleAttrValueItemType {
  id?: number;
  skuId?: number;
  spuId?: number;
  saleAttrValueId?: number;
  saleAttrId?: number;
  saleAttrName?: string;
  saleAttrValueName?: string;
}

// ? Sku 分页数据类型

// 返回值
export interface SkuListPageType {
  records: SkuListType;
  total: number;
  size: number;
  current: number;
  searchCount: boolean;
  pages: number;
}
